a = input()
def check(a):
  while '()' in a or '{}' in a or '[]' in a:
    a = a.replace('[]','')
    a = a.replace('()','')
    a = a.replace('{}','')
  return a
a = check(a)
print(a)
if len(a) > 0: print(False)
else: print(True)
